/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VIstaCategoria.java
 *
 * Created on 05/04/2011, 09:32:38 PM
 */

package vistas;

import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.util.LinkedList;
/**
 *
 * @author usuario
 */
public class VIstaCategoria extends javax.swing.JFrame {
    private controladores.ControladorCategoria control;

    /** Creates new form VIstaCategoria */
    public VIstaCategoria() {
        initComponents();
        control= new controladores.ControladorCategoria(this);
    }

    public void addListener(ActionListener escuchador){
        salir.addActionListener(escuchador);
        registrar.addActionListener(escuchador);
        cancelar.addActionListener(escuchador);
    }
    
    public void reiniciar(){
        codigo.setText("");
        descripcion.setText("");
    }

    

    public LinkedList<JTextField> getTextos() {
        LinkedList<JTextField> v = new LinkedList<JTextField>();
        v.add(codigo);
        v.add(descripcion);
        return v;
    }

    public JButton getCancelar() {
        return cancelar;
    }

    public JTextField getCodigo() {
        return codigo;
    }

    public JTextField getDescripcion() {
        return descripcion;
    }

    public JButton getRegistrar() {
        return registrar;
    }

    public JButton getSalir() {
        return salir;
    }






     



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        codigo = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        descripcion = new javax.swing.JTextField();
        registrar = new javax.swing.JButton();
        cancelar = new javax.swing.JButton();
        salir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Registro de Categorias");
        getContentPane().setLayout(null);

        jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
        jPanel1.setLayout(null);
        jPanel1.add(codigo);
        codigo.setBounds(140, 10, 110, 28);

        jLabel2.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel2.setText("Codigo:");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(20, 10, 130, 22);

        jLabel1.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel1.setText("Descripcion:");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(20, 60, 170, 22);
        jPanel1.add(descripcion);
        descripcion.setBounds(140, 60, 110, 28);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(20, 20, 260, 110);

        registrar.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        registrar.setText("Registrar");
        registrar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(registrar);
        registrar.setBounds(290, 20, 120, 30);

        cancelar.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        cancelar.setText("Cancelar");
        cancelar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(cancelar);
        cancelar.setBounds(290, 60, 120, 30);

        salir.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        salir.setText("Salir");
        getContentPane().add(salir);
        salir.setBounds(290, 100, 120, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-428)/2, (screenSize.height-182)/2, 428, 182);
    }// </editor-fold>//GEN-END:initComponents


    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VIstaCategoria().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cancelar;
    private javax.swing.JTextField codigo;
    private javax.swing.JTextField descripcion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton registrar;
    private javax.swing.JButton salir;
    // End of variables declaration//GEN-END:variables

}
